home *** CD-ROM | disk | FTP | other *** search
- function feet_on_ladder()
- {
- return _root.lad.hitTest(player._x,player._y + player._height / 2 - 1,true);
- }
- function level_under_my_feet()
- {
- return _root.lev.hitTest(player._x,player._y + player._height / 2,true);
- }
- function ladder_under_my_feet()
- {
- return _root.lad.hitTest(player._x,player._y + player._height / 2,true);
- }
- stop();
- score = 0;
- _root.attachMovie("jet_bar","jet_bar",_root.getNextHighestDepth(),{_x:95,_y:30});
- _root.attachMovie("player","player",_root.getNextHighestDepth(),{_x:40,_y:40});
- level1[0] = new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
- level1[1] = new Array(1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
- level1[2] = new Array(1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
- level1[3] = new Array(1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
- level1[4] = new Array(1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1);
- level1[5] = new Array(1,0,0,0,0,0,6,6,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1);
- level1[6] = new Array(1,0,0,0,0,0,1,1,1,4,0,0,1,1,0,0,0,2,0,0,0,0,0,0,1);
- level1[7] = new Array(1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1);
- level1[8] = new Array(1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,1);
- level1[9] = new Array(1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1);
- level1[10] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,6,0,1);
- level1[11] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,2,0,0,0,0,6,0,1);
- level1[12] = new Array(1,0,0,0,0,0,0,1,3,1,0,0,0,2,0,0,0,2,0,0,0,0,6,0,1);
- level1[13] = new Array(1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,6,0,1);
- level1[14] = new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,1,1,1,1,1,1);
- update();
- up = 1;
- lose_once = false;
- player.onEnterFrame = function()
- {
- p.sound_btn.onRelease = function()
- {
- if(son_ == true and stimer > 5)
- {
- sound.removeMovieClip();
- p.sound_btn.nextFrame();
- stopAllSounds();
- stimer = 0;
- sup = true;
- son_ = false;
- }
- if(son_ == false and stimer > 5)
- {
- attachMovie("sound","sound",_root.getNextHighestDepth());
- p.sound_btn.prevFrame();
- stimer = 0;
- sup = true;
- son_ = true;
- }
- };
- if(timers <= 0 and lose_once == false)
- {
- if(mode_ != 0)
- {
- lose_once = true;
- started_game = false;
- attachMovie("l","l",_root.getNextHighestDepth(),{_x:250,_y:150});
- l._alpha = 100;
- l.onEnterFrame = function()
- {
- if(ldecay == true)
- {
- this._alpha -= 2;
- if(this._alpha <= 0)
- {
- removeMovieClip(this);
- gotoAndStop("menu");
- }
- }
- this.menu_.onRelease = function()
- {
- ldecay = true;
- };
- };
- }
- }
- if(started_game == true)
- {
- if(jet_bar.jet_bar_inside._width < 108)
- {
- jet_bar.jet_bar_inside._width += 0.1;
- }
- if(Key.isDown(80))
- {
- up = 0;
- started_game = false;
- pdecay = false;
- decay2 = false;
- attachMovie("p","p",_root.getNextHighestDepth(),{_x:250,_y:150});
- p._alpha = 100;
- p.onEnterFrame = function()
- {
- if(pdecay == true)
- {
- this._alpha -= 2;
- if(this._alpha <= 0)
- {
- up = 1;
- started_game = true;
- removeMovieClip(this);
- }
- }
- if(decay2 == true)
- {
- this._alpha -= 2;
- if(this._alpha <= 0)
- {
- removeMovieClip(this);
- gotoAndStop("menu");
- }
- }
- this.back.onRelease = function()
- {
- pdecay = true;
- };
- this.menu_.onRelease = function()
- {
- decay2 = true;
- };
- };
- }
- timers -= up;
- show_score = "Coins : " + score;
- if(Key.isDown(37) || Key.isDown(65))
- {
- if(climbing)
- {
- this.gotoAndStop(2);
- xspeed = - climb_speed;
- }
- else if(walking_while_jumping or can_jump)
- {
- this.gotoAndStop(2);
- this.player_inside.play();
- xspeed = - walk_speed;
- }
- }
- else if(this._currentframe == 2)
- {
- this.player_inside.gotoAndStop(1);
- }
- if(Key.isDown(39) || Key.isDown(68))
- {
- if(climbing)
- {
- this.gotoAndStop(1);
- xspeed = climb_speed;
- }
- else if(walking_while_jumping or can_jump)
- {
- this.gotoAndStop(1);
- this.player_inside.play();
- xspeed = walk_speed;
- }
- }
- else if(this._currentframe == 1)
- {
- this.player_inside.gotoAndStop(1);
- }
- if(!feet_on_ladder())
- {
- climbing = false;
- }
- if(using_jetpack == false)
- {
- this.pack.gotoAndStop(1);
- }
- if(Key.isDown(38) || Key.isDown(87))
- {
- if(has_jetpack == true)
- {
- if(feet_on_ladder() == false)
- {
- this.player_inside.gotoAndStop(1);
- this.pack.gotoAndStop(2);
- using_jetpack = true;
- climbing = false;
- jumping = true;
- yspeed = - jet_speed;
- jet_bar.jet_bar_inside._width--;
- }
- }
- if(feet_on_ladder())
- {
- yspeed = - climb_speed;
- using_jetpack = false;
- climbing = true;
- jumping = false;
- }
- }
- else
- {
- using_jetpack = false;
- }
- if(jet_bar.jet_bar_inside._width <= 1)
- {
- using_jetpack = false;
- has_jetpack = false;
- }
- else
- {
- has_jetpack = true;
- }
- if(Key.isDown(40) || Key.isDown(83))
- {
- if(feet_on_ladder() or ladder_under_my_feet())
- {
- yspeed = climb_speed;
- climbing = true;
- jumping = false;
- }
- }
- if(Key.isDown(32) and can_jump and !jumping and !climbing)
- {
- yspeed -= jump_power;
- jumping = true;
- }
- if(!climbing)
- {
- yspeed += gravity;
- }
- if(yspeed > max_yspeed)
- {
- yspeed = max_yspeed;
- }
- if(level_under_my_feet() and !jumping and !climbing)
- {
- yspeed = 0;
- }
- if(ladder_under_my_feet() and !jumping and !climbing)
- {
- yspeed = 0;
- }
- forecast_x = this._x + xspeed;
- forecast_y = this._y + yspeed;
- if(_root.exit_door.hitTest(forecast_x,forecast_y + this._height / 2 - 1,true))
- {
- if(_currentframe == 22)
- {
- gotoAndStop("lose");
- }
- else
- {
- _root.nextFrame();
- }
- }
- if(_root.lasers.hitTest(forecast_x,forecast_y,true))
- {
- forecast_x = 40;
- forecast_y = 40;
- jumping = false;
- using_jetpack = false;
- has_jetpack = true;
- jet_bar.jet_bar_inside._width = 109;
- }
- if(_root.lava.hitTest(forecast_x,forecast_y + this._height / 2 - 1,true))
- {
- forecast_x = 40;
- forecast_y = 40;
- jumping = false;
- using_jetpack = false;
- has_jetpack = true;
- jet_bar.jet_bar_inside._width = 109;
- }
- while(_root.lev.hitTest(forecast_x,forecast_y + this._height / 2 - 1,true) or _root.moving.hitTest(forecast_x,forecast_y + this._height / 2 - 1,true))
- {
- forecast_y--;
- xspeed = 0;
- yspeed = 0;
- jumping = false;
- }
- while(_root.lev.hitTest(forecast_x,forecast_y - this._height / 2,true) or _root.lava.hitTest(forecast_x,forecast_y - this._height / 2,true) or _root.moving.hitTest(forecast_x,forecast_y - this._height / 2,true))
- {
- forecast_y++;
- yspeed = 0;
- }
- while(_root.lev.hitTest(forecast_x - this._width / 2 + 1,forecast_y,true))
- {
- forecast_x++;
- xspeed = 0;
- }
- while(_root.lev.hitTest(forecast_x + this._width / 2,forecast_y,true))
- {
- forecast_x--;
- xspeed = 0;
- }
- this._x = forecast_x;
- this._y = forecast_y;
- xspeed = 0;
- if(climbing)
- {
- yspeed = 0;
- }
- }
- };
- rcan = true;
- rtimer = 0;
- onEnterFrame = function()
- {
- if(rcan == false)
- {
- rtimer++;
- if(rtimer > 30)
- {
- rcan = true;
- rtimer = 0;
- }
- }
- if(Key.isDown(82))
- {
- if(rcan == true)
- {
- score -= rgain;
- update();
- }
- }
- };
- decay = false;
- started_game = false;
- attachMovie("info","info",_root.getNextHighestDepth(),{_x:250,_y:150});
- info._alpha = 100;
- info.onEnterFrame = function()
- {
- if(decay == true)
- {
- this._alpha -= 2;
- if(this._alpha <= 0)
- {
- started_game = true;
- removeMovieClip(this);
- }
- }
- if(started_game == false)
- {
- onMouseDown = function()
- {
- decay = true;
- };
- }
- };
-